 <%@ page language="java" contentType="text/plain; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*, java.net.*, java.io.* "%><%
		
    String wmsLocation = request.getParameter("url");
    String layerName = request.getParameter("layername");
    String xCoord = request.getParameter("x");
    String yCoord = request.getParameter("y");
    String bbox = request.getParameter("bbox");
    String height = request.getParameter("height");
    String width = request.getParameter("width");
    String format = "application/vnd.ogc.gml";
    //format = "text/html";
    if (!wmsLocation.contains("http")){
    	wmsLocation = "http://localhost:8580/wms";
    }
	String url$ = wmsLocation + "?service=wms&version=1.1.1&request=GetFeatureInfo&info_format=" + format + "&SRS=EPSG:900913&feature_count=1&styles=&height=" + height + "&width=" + width +"&bbox=" + bbox + "&x=" + xCoord + "&y=" + yCoord +"&query_layers=" + layerName + "&layers=" + layerName;

	System.out.println(" in getFeatureInformation, url = " + url$);
	URL url = new URL(url$);
	InputStream inputStream = url.openStream();
	InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
	BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
	String currentLine = bufferedReader.readLine();
	String html = "";
	while (currentLine != null)
	{
		currentLine = currentLine.replaceAll("\\n|\\r", " ");
		html = html + currentLine;
		System.out.println(currentLine);	
		currentLine = bufferedReader.readLine();
		
	}	
	html.trim();
	out.write(html);
%>
